<template>
  <div v-if="visible" class="gyk-loading">
    <div>{{ message }}</div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue';
const visible = ref(false);
const message = ref('loading...');

const show = () => {
  visible.value = true
}
const hide = () => {
  visible.value = false
}
// 修改message的值
const editMessage = (msg: string) => {
  message.value = msg;
}

defineExpose({
  show,
  hide,
  editMessage,
})
</script>

<style lang="scss" scoped>
@include b(loading) {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background-color: #ccc;
  color: white;
  font-size: 20px;
  text-align: center;
  z-index: 999;
}
</style>
